package com.wzy.activiti02;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

import java.io.IOException;

/**
 * 需求:
 * 历史数据的查看
 */
public class BusinessKeyAdd {
    public static void main(String[] args) throws IOException {
        //1.得到processEngine对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //2.得到RunTimeService对象
        RuntimeService runtimeService = processEngine.getRuntimeService();
        //3.启动流程实例,同时还要制定业务标识,businessKey, 本身就是请假单的id
        //第一个参数:流程定义的key,第二个参数代表的是:业务表示businessKey
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holiday", "1001");
        //4.输出processInstance相关的属性,取出businessKey
        System.out.println(processInstance.getBusinessKey());

    }
}
